<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.css">
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
    <script src="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.js"></script>
    <script src="../../js/bootstrap-table-zh-CN.min.js"></script>
</head>
<body>
<div class="container">
    <div class="row">
        <form class="form-inline" style="padding: 10px">
            <div class="container" style="margin-top: 5px">
                <input name="ename" id="ename" class="form-control">
                <select class="form-control" id="job">
                   <option value="">不限性别</option>
                   <option value="1">男</option>
                   <option value="0">女</option>
               </select>
                <input class="form-control" type="date">
                <input class="form-control" type="date">
                <select class="form-control" id="deptno">
                    <option value="">请选择部门</option>
                    <option value="1">开发部</option>
                    <option value="2">测试部</option>
                    <option value="3">人事部</option>
                </select>
                <input type="button" class="btn btn-primary" id="submit_select" value="查询"></input>
            </div>
        </form>
    </div>

    <!--<div class="row" style="margin-top: 20px">
        <div class="col-10">

        </div>
        <div class="col-2">
            <button class="btn btn-primary" onclick="add()" data-toggle="modal" data-target="#myModal">添加</button>
        </div>
    </div>-->

    <div class="container-fluid">
        <caption>
            <div style="float: right;margin-bottom: 5px">
                <button class="btn btn-primary btn-sm" data-toggle="modal" onclick="add()"
                data-target="#myModal">添加员工
                </button>
            </div>
        </caption>
    <table id="stutable"></table>
</div>

<!--模态框-->
<div class="modal fade" id="myModal">
    <div class="modal-dialog">
        <div class="modal-content">

            <!-- 模态框头部 -->
            <div class="modal-header">
                <h4 class="modal-title" id="tjyg"></h4>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>

            <!-- 模态框主体 -->
            <div class="modal-body">
                <form>
                    <input type="hidden" id="empno">
                    <div class="form-group" >
                        <label>姓名：</label>
                        <input type="text" class="form-control" id="ename2">
                    </div>
                    <div class="form-group">
                        <label>性别：</label>
                        <input type="text" class="form-control"  id="job1">
                    </div>
                    <div class="form-group" >
                        <label>薪水：</label>
                        <input type="text" class="form-control" id="sal1">
                    </div>
                    <div class="form-group" >
                        <label>入职日期：</label>
                        <input class="form-control" type="date" id="hiredate1">
                    </div>
                    <div class="form-group">
                        <label>所属部门：</label>
                        <select class="form-control" id="deptno1">
                            <option value="0">请选择部门</option>
                            <option value="1">开发部</option>
                            <option value="2">测试部</option>
                            <option value="3">人事部</option>
                        </select>
                    </div>
                    <div class="form-group" style="text-align: center">
                        <button type="button" class="btn btn-primary" data-dismiss="modal" id="add1" onclick="add2()"></button>
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    </div>
                </form>
            </div>

            <!-- 模态框底部 -->
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
</div>
<script src="../../js/info.js"></script>

</body>

<script>
    function add() {
        document.getElementById("add1").innerHTML="添加"
        document.getElementById("tjyg").innerHTML="添加员工"
    }
    function update() {
        document.getElementById("add1").innerHTML="修改"
        document.getElementById("tjyg").innerHTML="修改信息"
    }
</script>
<script>
    function add2() {

        let ename=document.getElementById("ename2").value;
        console.log(ename)
        let job=document.getElementById("job1").value;
        console.log(job)
        let sal=document.getElementById("sal1").value;
        let hiredate=document.getElementById("hiredate1").value;
        let deptno=document.getElementById("deptno1").value;
        $.get("http://localhost:8080/stu/insert",{ename1:ename,job1:job,sal1:sal,hiredate1:hiredate,deptno1:deptno},function (data) {

        })
    }
</script>
</html>